package com.tanhua.server.controller;

import com.aliyun.oss.common.comm.RepeatableInputStreamEntity;
import com.tanhua.domain.db.PageResult;
import com.tanhua.domain.vo.AnnouncementVo;
import com.tanhua.server.service.AnnouncementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/messages")
public class AnnouncementController {
    //注入AnnouncementService对象
    @Autowired
    private AnnouncementService announcementService;

    /**
     * 查询公告信息
     */
    @GetMapping("/announcements")
    public ResponseEntity getAnnouncements(@RequestParam(defaultValue = "1") Integer page, @RequestParam(defaultValue = "10")Integer pagesize) {
        //调用
      PageResult<AnnouncementVo> pageResult= announcementService.getAnnouncements(page,pagesize);
      //返回数据
        return ResponseEntity.ok(pageResult);
    }


}
